<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>M209 Simulator - Java Applet</title>
</head>
<body>
<h6><a href="index.html" title="Index">Index</a>
 - The M209 itself
 - <a href="modules.html" title="Modules">The simulator's modules</a>
 - <a href="m209simulator.html" title="The M209 Simulator">The M209 simulator</a>
 - <a href="settings.html" title="Settings">Examples of settings</a>
 - <a href="credits.html" title="Credits">Credits</a></h6>
</body>


<h1>Introduction</h1>

<p>This is a quick explanation of the M-209 itself. We recommend the interested reader to refer to our references for more information or to research using "C-38", "M-209" or "CSP-1500" key words.</p> 
<h1>History context</h1>
<p>The M-209 was mainly used by the US military during WWII. (called C-38 by Hagelin, CSP-1500 by the Navy and M-209 by the Army).</p>

<h1>Genealogy</h1>
<p>The  M-209 was designed by Boris Hagelin in 1938. Hagelin improve his previous cipher machine C-36 to come up with the C-38.</p>
<p>Most Hagelin cipher machines are based on the same principal. For more information on the genealogy you can refer to <a href="http://www.jproc.ca/crypto/ag_crypto_history.html" title="[JPROC-tree]">[JPROC-tree]</a>.</p>

<h1>Description</h1>
<p>For more details on the M-209, we recommend the interesed reader to refer to <a href="http://en.wikipedia.org/wiki/M-209" title="[WIKI-m209]">[WIKI-m209]</a>, <a href="http://hem.passagen.se/tan01/c38idx.html" title="[TOBY-c38]">[TOBY-c38]</a> and <a href="http://www.fredandre.fr/hagelinside.php?lang=en" title="[ANDRE-hagelin]">[ANDRE-hagelin]</a>.</p>
<img src="fig.jpg" alt="photo of M-209" width="480" />

<h1>Operation</h1>
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/sVy59ZrOrw4" frameborder="0" allowfullscreen></iframe>
<p>Other ressources:
<ul>
<li>Scans of the manual <a href="http://www.ilord.com/m209manual.html" title="[ILORD-manual]">[ILORD-manual]</a></li>
<li>30 min training film with transcript (show the additional conventions of use and transmission) <a href="http://www.ilord.com/m209-training.html" title="[ILORD-video]">[ILORD-video]</a> <i>(4 youtube videos)</i></li>
</ul>
</p>
<p>The convention use by the US-military to encipher a 'SPACE' is to use the letter 'Z' <a href="http://www.jproc.ca/crypto/m209.html" title="[JPROC-info]">[JPROC-info]</a>, when deciphering the 'Z's will be decoded in blanks. The original 'Z's must be placed manually. Moreover because the M-209 encipher by block of 5 letters, if the cipher text has an unfinished block, 'X's will be used to complete the block. <i>(Those behaviours are included in our <a href="m209simulator.html" title="The M209 Simulator"> M209 simulator</a>).</i></p>
<p> If you watch the videos <a href="http://www.ilord.com/m209-training.html" title="[ILORD-video]">[ILORD-video]</a>, you can learn how the operator comes up with the initial external key and what is really transmitted to the receiver.</p>

<h1>Ciphering Mechanism</h1>
<p>The M209 is a stream cipher that use at its lower level a Beaufort substitution letter by letter.</p>
<p>The Beaufort substitution skim is very similar to Ceasar's one but it uses the inverse alphabet.</p>
<pre>
ABCDEFG<b style="color:red;">H</b>IJKLMNOPQRSTUVWXYZ
ZYXW<b style="color:red;">V</b>UTSRQPONMLKJIHGFEDCBA
</pre>
<p>If the Beaufort key is 3 then the letter H would be encrypted by letter V (notice that V will be encoded by H - encryption and decryption are the same). <i>The Beaufort module of the simulator deals with this part (refer to <a href="modules.html" title="Modules">The simulator's modules</a>).</i></p>
<p>All the possible output can be sum up here:</p>
<pre>
plain: <b>ABCDEFG<b style="color:red;">H</b>IJKLMNOPQRSTUVWXYZ</b>
key=0: ZYXWVUTSRQPONMLKJIHGFEDCBA
key=1: AZYXWVUTSRQPONMLKJIHGFEDCB
key=2: BAZYXWVUTSRQPONMLKJIHGFEDC
key=<b style="color:red;">3</b>: CBAZYXW<b style="color:red;">V</b>UTSRQPONMLKJIHGFED
    4: DCBAZYXWVUTSRQPONMLKJIHGFE
    5: EDCBAZYXWVUTSRQPONMLKJIHGF
    6: FEDCBAZYXWVUTSRQPONMLKJIHG
    7: GFEDCBAZYXWVUTSRQPONMLKJIH
    8: HGFEDCBAZYXWVUTSRQPONMLKJI
    9: IHGFEDCBAZYXWVUTSRQPONMLKJ
   10: JIHGFEDCBAZYXWVUTSRQPONMLK
   11: KJIHGFEDCBAZYXWVUTSRQPONML
   12: LKJIHGFEDCBAZYXWVUTSRQPONM
   13: MLKJIHGFEDCBAZYXWVUTSRQPON
   14: NMLKJIHGFEDCBAZYXWVUTSRQPO
   15: ONMLKJIHGFEDCBAZYXWVUTSRQP
   16: PONMLKJIHGFEDCBAZYXWVUTSRQ
   17: QPONMLKJIHGFEDCBAZYXWVUTSR
   18: RQPONMLKJIHGFEDCBAZYXWVUTS
   19: SRQPONMLKJIHGFEDCBAZYXWVUT
   20: TSRQPONMLKJIHGFEDCBAZYXWVU
   21: UTSRQPONMLKJIHGFEDCBAZYXWV
   22: VUTSRQPONMLKJIHGFEDCBAZYXW
   23: WVUTSRQPONMLKJIHGFEDCBAZYX  
   24: XWVUTSRQPONMLKJIHGFEDCBAZY  
   25: YXWVUTSRQPONMLKJIHGFEDCBAZ    
</pre>
<p>As most stream cipher, the idea now is to come up with a infinite sequence of Beaufort keys that looks random. Getting one Beaufort key is realized with the settings and the mechanism of the M209. For every letter the external key will be incremented in order to come up with a new Beaufort key. <i>(Refer to the GetNextExternalKey module of <a href="modules.html" title="Modules">The simulator's modules</a>).</i></p>
<p>Basically, for every bar if at least one arm meet a lug, the inverse alphabet will shit by one. Globally the Beaufort key will be the number of time that for one bar at least one arm is used. <i>(Refer to the GetBeaufortKey module of <a href="modules.html" title="Modules">The simulator's modules</a>).</i></p>
<p>An arm is used, if it is active and if the associated position of a bar is full with a lug. An arm is active if the active letter of the wheel have an effective pin.</p>

<p>Now when the operator turn the handle, the drum with make a full revolution and all the active arms will 'see' every bar.</p>

<h1>Related Work</h1>
<p>M-209 Simulators can already be found. The most famous <a href="http://users.telenet.be/d.rijmenants/en/m209sim.htm" title="[RIJMENANTS-gSim]">[RIJMENANTS-gSim]</a> is a graphic simulator show the details of the M-209 mechanism. <a href="http://www.nf6x.net/crypto/hagelin/hagelin.html" title="[GREEN-cSim]">[GREEN-cSim]</a> is just a C program that hide most of the behaviour of the M-209. The PHP simulator <a href="http://www.fredandre.fr/hagelinsimu.php?lang=en" title="[ANDRE-phpSim]">[ANDRE-phpSim]</a> is the only one so far that is web based.</p>


<h1>References</h1>
<p>
<ul>
<li><a href="http://www.jproc.ca/crypto/ag_crypto_history.html" title="[JPROC-tree]">[JPROC-tree]</a> Genealogy tree of the Hagelin cipher machine.</li>
<li><a href="http://en.wikipedia.org/wiki/M-209" title="[WIKI-m209]">[WIKI-m209]</a> Wikipedia article on the M-209</li>
<li><a href="http://hem.passagen.se/tan01/c38idx.html" title="[TOBY-c38]">[TOBY-c38]</a> Toby's page on the C-38 / M-209 cipher machine</li>
<li><a href="http://www.fredandre.fr/hagelinside.php?lang=en" title="[ANDRE-hagelin]">[ANDRE-hagelin]</a> Fred Andre explanation of the Hagelin cipher machine</li>
<li><a href="http://www.ilord.com/m209manual.html" title="[ILORD-manual]">[ILORD-manual]</a> Scans of the M-209 manual</li>
<li><a href="http://www.ilord.com/m209-training.html" title="[ILORD-video]">[ILORD-video]</a> Training film of the M-209 (and transcript) </li>
<li><a href="http://www.jproc.ca/crypto/m209.html" title="[JPROC-info]">[JPROC-info]</a> Jerry Proc's page on the M-209 / CSP-1500</li>
<li><a href="http://users.telenet.be/d.rijmenants/en/m209sim.htm" title="[RIJMENANTS-gSim]">[RIJMENANTS-gSim]</a> Dirk Rijmenants' graphic simulator</li>
<li><a href="http://www.nf6x.net/crypto/hagelin/hagelin.html" title="[GREEN-cSim]">[GREEN-cSim]</a> Mark Green's C simulator</li>
<li><a href="http://www.fredandre.fr/hagelinsimu.php?lang=en" title="[ANDRE-phpSim]">[ANDRE-phpSim]</a> Fred Andre's PHP simulator</li>
</ul>
</p>
</html>